package com.example.demo.controller;

import com.example.demo.entity.Socket;
import com.example.demo.req.SocketReq;
import com.example.demo.service.SocketService;
import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/socket")
public class SorketController {
    @Autowired
    private SocketService socketService;
    @GetMapping("isStartAll")
    @ApiOperation("是否启动全部服务 state 0:停止，1，启动")
    public boolean isStartAll(@RequestParam Integer state){
        return socketService.isStartAll(state);
    }
    @PostMapping("isStart")
    @ApiOperation("是否启动相关服务")
    public boolean isStart(@RequestParam Integer state, @RequestBody List<Socket> socketReqList){
        return socketService.isStart(state,socketReqList);
    }
    @PostMapping("state")
    @ApiOperation("服务状态")
    public List<Socket> state(@RequestBody List<Socket> socketReqs){
        return socketService.state(socketReqs);
    }
    @GetMapping("allState")
    @ApiOperation("所有服务的状态")
    public List<Socket> allState(){
        return socketService.allState();
    }




}
